package com.tanhua.controller;

import com.tanhua.domain.vo.PageBeanVo;
import com.tanhua.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author user
 */
@RestController
@CrossOrigin
@RequestMapping("/usermessage")
public class UserInfoController {
    @Autowired
    public UserInfoService userInfoService;

    /**
     * 查询用户列表
     *
     * @return
     */
    @PostMapping("/userinfo")
    public ResponseEntity getUserInfoList(@RequestBody Map map) {
        Integer page = Integer.parseInt(map.get("page").toString());
        Integer pageSize = Integer.parseInt(map.get("pagesize").toString());
        PageBeanVo pageBeanVo = userInfoService.getUserInfoList(page, pageSize);
        return ResponseEntity.ok(pageBeanVo);
    }


    /**
     * 获取坐标
     *
     * @return
     */
    @GetMapping("/getCoordinates/{userid}")
    public ResponseEntity getCoordinates(@PathVariable("userid") String userid) {
        return userInfoService.getCoordinates(userid);
    }
}
